import axios from 'axios'
import tool from '../until/tool'
const baseURL = import.meta.env.VITE_APP_BASEURL_ADMIN
let tagNameList:Array<string> = ["紫外","红外","温度","湿度","压力"] // 报警的模块类型

self.onmessage = async (e) => {
    let level:number = e.data.level            // 模块状态
    let data:number = e.data.data         // 模块数据      //主机编号
    let module_id: number = e.data.module_id   // 模块编号
    let type: number = e.data.type // 类型
    let info: string = e.data.info //报警信息
    let date:string = tool.tool.getCurrentDate()
    await axios.post(baseURL +"/admin/addErrorRecord",{
      date,
      module_id,
      state: 0,
      level,
      info,
      type_id: type,
      error_value: data
    })
}